package ie.dcu.spca.model.bean;

import ie.dcu.spca.model.Bean;
import ie.dcu.spca.model.dao.UserDao;

import java.util.Date;

public class Bill extends Bean {
    private String location;
    private int user_id;

    public Bill(int id, String location, int user_id, Date creat_at,
            Date update_at, Date delete_at) {
        this.id = id;
        this.location = location;
        this.user_id = user_id;
        this.create_at = creat_at;
        this.update_at = update_at;
        this.delete_at = delete_at;
    }

    public Bill(int id, String location, int user_id, long creat_at,
            long update_at, long delete_at) {
        this.id = id;
        this.location = location;
        this.user_id = user_id;
        this.create_at = new Date(creat_at);
        this.update_at = new Date(update_at);
        this.delete_at = new Date(delete_at);
    }

    // auto generation getter and setter
    public Date getDelete_at() {
        return delete_at;
    }

    public void setDelete_at(Date delete_at) {
        this.delete_at = delete_at;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    public User getUser() {
        UserDao ud = new UserDao();
        return (User) ud.selectById(this.user_id);
    }

    public int getUser_id() {
        return user_id;
    }

    public void setUser_id(int user_id) {
        this.user_id = user_id;
    }

    public Date getCreate_at() {
        return create_at;
    }

    public void setCreate_at(Date creat_at) {
        this.create_at = creat_at;
    }

    public Date getUpdate_at() {
        return update_at;
    }

    public void setUpdate_at(Date update_at) {
        this.update_at = update_at;
    }
}
